package com.office.forum.manage.comments.controller;

import com.office.common.core.domain.AjaxResult;
import com.office.forum.manage.comments.domain.ForumComments;
import com.office.forum.manage.comments.service.ForumSelectTimeSevice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/manage/comments/time")
public class ForumSelectTimeController {
        @Autowired
        private ForumSelectTimeSevice forumSelectTimeSevice;

//        选择时间段
        @GetMapping("/{selectTimeRange}")
        public AjaxResult getComments(@PathVariable String selectTimeRange){

            List<ForumComments> comments = forumSelectTimeSevice.getCommentsByTimeRange(selectTimeRange);
            return AjaxResult.success("data", comments).put("total", comments.size());
        }
    }

